package com.climber.android.commonres.widget.loading

import android.view.View
import io.library.android.loading.Gloading

/**
 * Created by Mikes at 2019/4/14
 */
class GLoadingDefaultAdapter : Gloading.Adapter {

    override fun getView(holder: Gloading.Holder, convertView: View?, status: Int): View {
        var loadingStatusView: GlobalLoadingStatusView? = null
        //reuse the old view, if possible
        if (convertView != null && convertView is GlobalLoadingStatusView) {
            loadingStatusView = convertView
        }
        if (loadingStatusView == null) {
            loadingStatusView = GlobalLoadingStatusView(holder)
        }
        loadingStatusView.setStatus(status, holder.data?.get(status))
        return loadingStatusView
    }
}
